//********************************************************
// PopupMenu.java
// Date: 4/4/2012
// Author: Jeff Xiong
//********************************************************
// Point class to hold point information
// ******************************************************
package functionality;

public class Point {
	private int _x;
	private int _y;

	/**
	 * Point constructor setting x and y to -1 to be invalid
	 * 
	 * @param none
	 * @return Point object just created
	 */
	public Point()
	{
		_x = _y = -1;
	}

	/**
	 * Point constructor setting x and y from input parameters
	 * 
	 * @param x coordinate
	 * @param y coordinate
	 * @return Point object just created
	 */
	public Point(int x, int y)
	{
		_x = x;
		_y = y;
	}

	/**
	 * Point constructor setting x and y from Point input parameter
	 * 
	 * @param Point object
	 * @return Point object just created
	 */
	public Point(Point tileLocation)
	{
		_x = tileLocation.getX();
		_y = tileLocation.getY();
	}

	/**
	 * Get the x coordinate
	 * 
	 * @param none
	 * @return x coordinate of the point
	 */
	public int getX()
	{
		return _x;
	}

	/**
	 * Get the y coordinate
	 * 
	 * @param none
	 * @return y coordinate of the point
	 */
	public int getY()
	{
		return _y;
	}

	/**
	 * Sets the x coordinate of the point
	 * 
	 * @param x coordinate
	 * @return none
	 */
	public void setX(int x)
	{
		_x = x;
	}

	/**
	 * Sets the y coordinate of the point
	 * 
	 * @param y coordinate
	 * @return none
	 */
	public void setY(int y)
	{
		_y = y;
	}
	
	/**
	 * Used to check if two points are pointing to the same location (based on x & y coordinates)
	 * 
	 * @param Point p for comparison
	 * @return none
	 */
	public boolean equals(Point p)
	{
		if(p.getX()==this.getX()&&p.getY()==this.getY())return true;
		return false;
	}
}
